Skip to content

fix(stringify): keep indent indicator and header comments on empty block scalars - #745

Open
princejain756 wants to merge 1 commit into
eemeli:mainfrom
princejain756:fix/empty-block-scalar-comments
Open

princejain756 wants to merge 1 commit into
eemeli:mainfrom
princejain756:fix/empty-block-scalar-comments

Conversation

@princejain756

Copy link
Copy Markdown

Fixes #687.

When an empty block scalar appears at the document root with a trailing comment (ctx.forceBlockIndent), blockString returned |\n early without an indent indicator or header comment, so the trailing comment was parsed as block scalar content on re-parse. It now includes the indent indicator when forceBlockIndent is set, writes inline scalar comments on the header line via onComment, and stringifyDocument avoids pushing an extra empty line when the body already ends with \n.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

toString() incorrectly converts comment to string

1 participant